package com.supos.progress;

import com.supos.progress.redmine.query.IssueQuery;
import com.taskadapter.redmineapi.RedmineException;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 */
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        IssueQuery service = contextRefreshedEvent.getApplicationContext().getBean(IssueQuery.class);
        try {
            service.initData();
        } catch (RedmineException e) {
            e.printStackTrace();
        }
    }
}
